/*********************
* Author:Dzlua
* QQ:505544956
* time:2016/07/19
* warring: modified from SDL_keycode.h SDL2 2.0.4
*/
#ifndef __EDUI_KEYCODE_H__
#define __EDUI_KEYCODE_H__

#include "Scancode.h"

EDUI_NAMESPACE_BEGIN

/**
 * \brief Enumeration of valid key mods (possibly OR'd together).
 */
typedef enum
{
    KEYMOD_NONE = 0x0000,
    KEYMOD_LSHIFT = 0x0001,
    KEYMOD_RSHIFT = 0x0002,
    KEYMOD_LCTRL = 0x0040,
    KEYMOD_RCTRL = 0x0080,
    KEYMOD_LALT = 0x0100,
    KEYMOD_RALT = 0x0200,
    KEYMOD_LGUI = 0x0400,
    KEYMOD_RGUI = 0x0800,
    KEYMOD_NUM = 0x1000,
    KEYMOD_CAPS = 0x2000,
    KEYMOD_MODE = 0x4000,
    KEYMOD_RESERVED = 0x8000
} KeyMod;

#define KEYMOD_CTRL   (KEYMOD_LCTRL|KEYMOD_RCTRL)
#define KEYMOD_SHIFT  (KEYMOD_LSHIFT|KEYMOD_RSHIFT)
#define KEYMOD_ALT    (KEYMOD_LALT|KEYMOD_RALT)
#define KEYMOD_GUI    (KEYMOD_LGUI|KEYMOD_RGUI)

#define KEY_SCANCODE_MASK (1<<30)
#define SCANCODE_TO_KEYCODE(X)  (X | KEY_SCANCODE_MASK)

enum
{
    KEY_UNKNOWN = 0,

    KEY_RETURN = '\r',
    KEY_ESCAPE = '\033',
    KEY_BACKSPACE = '\b',
    KEY_TAB = '\t',
    KEY_SPACE = ' ',
    KEY_EXCLAIM = '!',
    KEY_QUOTEDBL = '"',
    KEY_HASH = '#',
    KEY_PERCENT = '%',
    KEY_DOLLAR = '$',
    KEY_AMPERSAND = '&',
    KEY_QUOTE = '\'',
    KEY_LEFTPAREN = '(',
    KEY_RIGHTPAREN = ')',
    KEY_ASTERISK = '*',
    KEY_PLUS = '+',
    KEY_COMMA = ',',
    KEY_MINUS = '-',
    KEY_PERIOD = '.',
    KEY_SLASH = '/',
    KEY_0 = '0',
    KEY_1 = '1',
    KEY_2 = '2',
    KEY_3 = '3',
    KEY_4 = '4',
    KEY_5 = '5',
    KEY_6 = '6',
    KEY_7 = '7',
    KEY_8 = '8',
    KEY_9 = '9',
    KEY_COLON = ':',
    KEY_SEMICOLON = ';',
    KEY_LESS = '<',
    KEY_EQUALS = '=',
    KEY_GREATER = '>',
    KEY_QUESTION = '?',
    KEY_AT = '@',
    /*
       Skip uppercase letters
     */
    KEY_LEFTBRACKET = '[',
    KEY_BACKSLASH = '\\',
    KEY_RIGHTBRACKET = ']',
    KEY_CARET = '^',
    KEY_UNDERSCORE = '_',
    KEY_BACKQUOTE = '`',
    KEY_A = 'a',
    KEY_B = 'b',
    KEY_C = 'c',
    KEY_D = 'd',
    KEY_E = 'e',
    KEY_F = 'f',
    KEY_G = 'g',
    KEY_H = 'h',
    KEY_I = 'i',
    KEY_J = 'j',
    KEY_K = 'k',
    KEY_L = 'l',
    KEY_M = 'm',
    KEY_N = 'n',
    KEY_O = 'o',
    KEY_P = 'p',
    KEY_Q = 'q',
    KEY_R = 'r',
    KEY_S = 's',
    KEY_T = 't',
    KEY_U = 'u',
    KEY_V = 'v',
    KEY_W = 'w',
    KEY_X = 'x',
    KEY_Y = 'y',
    KEY_Z = 'z',

    KEY_CAPSLOCK = SCANCODE_TO_KEYCODE(SCANCODE_CAPSLOCK),

    KEY_F1 = SCANCODE_TO_KEYCODE(SCANCODE_F1),
    KEY_F2 = SCANCODE_TO_KEYCODE(SCANCODE_F2),
    KEY_F3 = SCANCODE_TO_KEYCODE(SCANCODE_F3),
    KEY_F4 = SCANCODE_TO_KEYCODE(SCANCODE_F4),
    KEY_F5 = SCANCODE_TO_KEYCODE(SCANCODE_F5),
    KEY_F6 = SCANCODE_TO_KEYCODE(SCANCODE_F6),
    KEY_F7 = SCANCODE_TO_KEYCODE(SCANCODE_F7),
    KEY_F8 = SCANCODE_TO_KEYCODE(SCANCODE_F8),
    KEY_F9 = SCANCODE_TO_KEYCODE(SCANCODE_F9),
    KEY_F10 = SCANCODE_TO_KEYCODE(SCANCODE_F10),
    KEY_F11 = SCANCODE_TO_KEYCODE(SCANCODE_F11),
    KEY_F12 = SCANCODE_TO_KEYCODE(SCANCODE_F12),

    KEY_PRINTSCREEN = SCANCODE_TO_KEYCODE(SCANCODE_PRINTSCREEN),
    KEY_SCROLLLOCK = SCANCODE_TO_KEYCODE(SCANCODE_SCROLLLOCK),
    KEY_PAUSE = SCANCODE_TO_KEYCODE(SCANCODE_PAUSE),
    KEY_INSERT = SCANCODE_TO_KEYCODE(SCANCODE_INSERT),
    KEY_HOME = SCANCODE_TO_KEYCODE(SCANCODE_HOME),
    KEY_PAGEUP = SCANCODE_TO_KEYCODE(SCANCODE_PAGEUP),
    KEY_DELETE = '\177',
    KEY_END = SCANCODE_TO_KEYCODE(SCANCODE_END),
    KEY_PAGEDOWN = SCANCODE_TO_KEYCODE(SCANCODE_PAGEDOWN),
    KEY_RIGHT = SCANCODE_TO_KEYCODE(SCANCODE_RIGHT),
    KEY_LEFT = SCANCODE_TO_KEYCODE(SCANCODE_LEFT),
    KEY_DOWN = SCANCODE_TO_KEYCODE(SCANCODE_DOWN),
    KEY_UP = SCANCODE_TO_KEYCODE(SCANCODE_UP),

    KEY_NUMLOCKCLEAR = SCANCODE_TO_KEYCODE(SCANCODE_NUMLOCKCLEAR),
    KEY_KP_DIVIDE = SCANCODE_TO_KEYCODE(SCANCODE_KP_DIVIDE),
    KEY_KP_MULTIPLY = SCANCODE_TO_KEYCODE(SCANCODE_KP_MULTIPLY),
    KEY_KP_MINUS = SCANCODE_TO_KEYCODE(SCANCODE_KP_MINUS),
    KEY_KP_PLUS = SCANCODE_TO_KEYCODE(SCANCODE_KP_PLUS),
    KEY_KP_ENTER = SCANCODE_TO_KEYCODE(SCANCODE_KP_ENTER),
    KEY_KP_1 = SCANCODE_TO_KEYCODE(SCANCODE_KP_1),
    KEY_KP_2 = SCANCODE_TO_KEYCODE(SCANCODE_KP_2),
    KEY_KP_3 = SCANCODE_TO_KEYCODE(SCANCODE_KP_3),
    KEY_KP_4 = SCANCODE_TO_KEYCODE(SCANCODE_KP_4),
    KEY_KP_5 = SCANCODE_TO_KEYCODE(SCANCODE_KP_5),
    KEY_KP_6 = SCANCODE_TO_KEYCODE(SCANCODE_KP_6),
    KEY_KP_7 = SCANCODE_TO_KEYCODE(SCANCODE_KP_7),
    KEY_KP_8 = SCANCODE_TO_KEYCODE(SCANCODE_KP_8),
    KEY_KP_9 = SCANCODE_TO_KEYCODE(SCANCODE_KP_9),
    KEY_KP_0 = SCANCODE_TO_KEYCODE(SCANCODE_KP_0),
    KEY_KP_PERIOD = SCANCODE_TO_KEYCODE(SCANCODE_KP_PERIOD),

    KEY_APPLICATION = SCANCODE_TO_KEYCODE(SCANCODE_APPLICATION),
    KEY_POWER = SCANCODE_TO_KEYCODE(SCANCODE_POWER),
    KEY_KP_EQUALS = SCANCODE_TO_KEYCODE(SCANCODE_KP_EQUALS),
    KEY_F13 = SCANCODE_TO_KEYCODE(SCANCODE_F13),
    KEY_F14 = SCANCODE_TO_KEYCODE(SCANCODE_F14),
    KEY_F15 = SCANCODE_TO_KEYCODE(SCANCODE_F15),
    KEY_F16 = SCANCODE_TO_KEYCODE(SCANCODE_F16),
    KEY_F17 = SCANCODE_TO_KEYCODE(SCANCODE_F17),
    KEY_F18 = SCANCODE_TO_KEYCODE(SCANCODE_F18),
    KEY_F19 = SCANCODE_TO_KEYCODE(SCANCODE_F19),
    KEY_F20 = SCANCODE_TO_KEYCODE(SCANCODE_F20),
    KEY_F21 = SCANCODE_TO_KEYCODE(SCANCODE_F21),
    KEY_F22 = SCANCODE_TO_KEYCODE(SCANCODE_F22),
    KEY_F23 = SCANCODE_TO_KEYCODE(SCANCODE_F23),
    KEY_F24 = SCANCODE_TO_KEYCODE(SCANCODE_F24),
    KEY_EXECUTE = SCANCODE_TO_KEYCODE(SCANCODE_EXECUTE),
    KEY_HELP = SCANCODE_TO_KEYCODE(SCANCODE_HELP),
    KEY_MENU = SCANCODE_TO_KEYCODE(SCANCODE_MENU),
    KEY_SELECT = SCANCODE_TO_KEYCODE(SCANCODE_SELECT),
    KEY_STOP = SCANCODE_TO_KEYCODE(SCANCODE_STOP),
    KEY_AGAIN = SCANCODE_TO_KEYCODE(SCANCODE_AGAIN),
    KEY_UNDO = SCANCODE_TO_KEYCODE(SCANCODE_UNDO),
    KEY_CUT = SCANCODE_TO_KEYCODE(SCANCODE_CUT),
    KEY_COPY = SCANCODE_TO_KEYCODE(SCANCODE_COPY),
    KEY_PASTE = SCANCODE_TO_KEYCODE(SCANCODE_PASTE),
    KEY_FIND = SCANCODE_TO_KEYCODE(SCANCODE_FIND),
    KEY_MUTE = SCANCODE_TO_KEYCODE(SCANCODE_MUTE),
    KEY_VOLUMEUP = SCANCODE_TO_KEYCODE(SCANCODE_VOLUMEUP),
    KEY_VOLUMEDOWN = SCANCODE_TO_KEYCODE(SCANCODE_VOLUMEDOWN),
    KEY_KP_COMMA = SCANCODE_TO_KEYCODE(SCANCODE_KP_COMMA),
    KEY_KP_EQUALSAS400 =
        SCANCODE_TO_KEYCODE(SCANCODE_KP_EQUALSAS400),

    KEY_ALTERASE = SCANCODE_TO_KEYCODE(SCANCODE_ALTERASE),
    KEY_SYSREQ = SCANCODE_TO_KEYCODE(SCANCODE_SYSREQ),
    KEY_CANCEL = SCANCODE_TO_KEYCODE(SCANCODE_CANCEL),
    KEY_CLEAR = SCANCODE_TO_KEYCODE(SCANCODE_CLEAR),
    KEY_PRIOR = SCANCODE_TO_KEYCODE(SCANCODE_PRIOR),
    KEY_RETURN2 = SCANCODE_TO_KEYCODE(SCANCODE_RETURN2),
    KEY_SEPARATOR = SCANCODE_TO_KEYCODE(SCANCODE_SEPARATOR),
    KEY_OUT = SCANCODE_TO_KEYCODE(SCANCODE_OUT),
    KEY_OPER = SCANCODE_TO_KEYCODE(SCANCODE_OPER),
    KEY_CLEARAGAIN = SCANCODE_TO_KEYCODE(SCANCODE_CLEARAGAIN),
    KEY_CRSEL = SCANCODE_TO_KEYCODE(SCANCODE_CRSEL),
    KEY_EXSEL = SCANCODE_TO_KEYCODE(SCANCODE_EXSEL),

    KEY_KP_00 = SCANCODE_TO_KEYCODE(SCANCODE_KP_00),
    KEY_KP_000 = SCANCODE_TO_KEYCODE(SCANCODE_KP_000),
    KEY_THOUSANDSSEPARATOR =
        SCANCODE_TO_KEYCODE(SCANCODE_THOUSANDSSEPARATOR),
    KEY_DECIMALSEPARATOR =
        SCANCODE_TO_KEYCODE(SCANCODE_DECIMALSEPARATOR),
    KEY_CURRENCYUNIT = SCANCODE_TO_KEYCODE(SCANCODE_CURRENCYUNIT),
    KEY_CURRENCYSUBUNIT =
        SCANCODE_TO_KEYCODE(SCANCODE_CURRENCYSUBUNIT),
    KEY_KP_LEFTPAREN = SCANCODE_TO_KEYCODE(SCANCODE_KP_LEFTPAREN),
    KEY_KP_RIGHTPAREN = SCANCODE_TO_KEYCODE(SCANCODE_KP_RIGHTPAREN),
    KEY_KP_LEFTBRACE = SCANCODE_TO_KEYCODE(SCANCODE_KP_LEFTBRACE),
    KEY_KP_RIGHTBRACE = SCANCODE_TO_KEYCODE(SCANCODE_KP_RIGHTBRACE),
    KEY_KP_TAB = SCANCODE_TO_KEYCODE(SCANCODE_KP_TAB),
    KEY_KP_BACKSPACE = SCANCODE_TO_KEYCODE(SCANCODE_KP_BACKSPACE),
    KEY_KP_A = SCANCODE_TO_KEYCODE(SCANCODE_KP_A),
    KEY_KP_B = SCANCODE_TO_KEYCODE(SCANCODE_KP_B),
    KEY_KP_C = SCANCODE_TO_KEYCODE(SCANCODE_KP_C),
    KEY_KP_D = SCANCODE_TO_KEYCODE(SCANCODE_KP_D),
    KEY_KP_E = SCANCODE_TO_KEYCODE(SCANCODE_KP_E),
    KEY_KP_F = SCANCODE_TO_KEYCODE(SCANCODE_KP_F),
    KEY_KP_XOR = SCANCODE_TO_KEYCODE(SCANCODE_KP_XOR),
    KEY_KP_POWER = SCANCODE_TO_KEYCODE(SCANCODE_KP_POWER),
    KEY_KP_PERCENT = SCANCODE_TO_KEYCODE(SCANCODE_KP_PERCENT),
    KEY_KP_LESS = SCANCODE_TO_KEYCODE(SCANCODE_KP_LESS),
    KEY_KP_GREATER = SCANCODE_TO_KEYCODE(SCANCODE_KP_GREATER),
    KEY_KP_AMPERSAND = SCANCODE_TO_KEYCODE(SCANCODE_KP_AMPERSAND),
    KEY_KP_DBLAMPERSAND =
        SCANCODE_TO_KEYCODE(SCANCODE_KP_DBLAMPERSAND),
    KEY_KP_VERTICALBAR =
        SCANCODE_TO_KEYCODE(SCANCODE_KP_VERTICALBAR),
    KEY_KP_DBLVERTICALBAR =
        SCANCODE_TO_KEYCODE(SCANCODE_KP_DBLVERTICALBAR),
    KEY_KP_COLON = SCANCODE_TO_KEYCODE(SCANCODE_KP_COLON),
    KEY_KP_HASH = SCANCODE_TO_KEYCODE(SCANCODE_KP_HASH),
    KEY_KP_SPACE = SCANCODE_TO_KEYCODE(SCANCODE_KP_SPACE),
    KEY_KP_AT = SCANCODE_TO_KEYCODE(SCANCODE_KP_AT),
    KEY_KP_EXCLAM = SCANCODE_TO_KEYCODE(SCANCODE_KP_EXCLAM),
    KEY_KP_MEMSTORE = SCANCODE_TO_KEYCODE(SCANCODE_KP_MEMSTORE),
    KEY_KP_MEMRECALL = SCANCODE_TO_KEYCODE(SCANCODE_KP_MEMRECALL),
    KEY_KP_MEMCLEAR = SCANCODE_TO_KEYCODE(SCANCODE_KP_MEMCLEAR),
    KEY_KP_MEMADD = SCANCODE_TO_KEYCODE(SCANCODE_KP_MEMADD),
    KEY_KP_MEMSUBTRACT =
        SCANCODE_TO_KEYCODE(SCANCODE_KP_MEMSUBTRACT),
    KEY_KP_MEMMULTIPLY =
        SCANCODE_TO_KEYCODE(SCANCODE_KP_MEMMULTIPLY),
    KEY_KP_MEMDIVIDE = SCANCODE_TO_KEYCODE(SCANCODE_KP_MEMDIVIDE),
    KEY_KP_PLUSMINUS = SCANCODE_TO_KEYCODE(SCANCODE_KP_PLUSMINUS),
    KEY_KP_CLEAR = SCANCODE_TO_KEYCODE(SCANCODE_KP_CLEAR),
    KEY_KP_CLEARENTRY = SCANCODE_TO_KEYCODE(SCANCODE_KP_CLEARENTRY),
    KEY_KP_BINARY = SCANCODE_TO_KEYCODE(SCANCODE_KP_BINARY),
    KEY_KP_OCTAL = SCANCODE_TO_KEYCODE(SCANCODE_KP_OCTAL),
    KEY_KP_DECIMAL = SCANCODE_TO_KEYCODE(SCANCODE_KP_DECIMAL),
    KEY_KP_HEXADECIMAL =
        SCANCODE_TO_KEYCODE(SCANCODE_KP_HEXADECIMAL),

    KEY_LCTRL = SCANCODE_TO_KEYCODE(SCANCODE_LCTRL),
    KEY_LSHIFT = SCANCODE_TO_KEYCODE(SCANCODE_LSHIFT),
    KEY_LALT = SCANCODE_TO_KEYCODE(SCANCODE_LALT),
    KEY_LGUI = SCANCODE_TO_KEYCODE(SCANCODE_LGUI),
    KEY_RCTRL = SCANCODE_TO_KEYCODE(SCANCODE_RCTRL),
    KEY_RSHIFT = SCANCODE_TO_KEYCODE(SCANCODE_RSHIFT),
    KEY_RALT = SCANCODE_TO_KEYCODE(SCANCODE_RALT),
    KEY_RGUI = SCANCODE_TO_KEYCODE(SCANCODE_RGUI),

    KEY_MODE = SCANCODE_TO_KEYCODE(SCANCODE_MODE),

    KEY_AUDIONEXT = SCANCODE_TO_KEYCODE(SCANCODE_AUDIONEXT),
    KEY_AUDIOPREV = SCANCODE_TO_KEYCODE(SCANCODE_AUDIOPREV),
    KEY_AUDIOSTOP = SCANCODE_TO_KEYCODE(SCANCODE_AUDIOSTOP),
    KEY_AUDIOPLAY = SCANCODE_TO_KEYCODE(SCANCODE_AUDIOPLAY),
    KEY_AUDIOMUTE = SCANCODE_TO_KEYCODE(SCANCODE_AUDIOMUTE),
    KEY_MEDIASELECT = SCANCODE_TO_KEYCODE(SCANCODE_MEDIASELECT),
    KEY_WWW = SCANCODE_TO_KEYCODE(SCANCODE_WWW),
    KEY_MAIL = SCANCODE_TO_KEYCODE(SCANCODE_MAIL),
    KEY_CALCULATOR = SCANCODE_TO_KEYCODE(SCANCODE_CALCULATOR),
    KEY_COMPUTER = SCANCODE_TO_KEYCODE(SCANCODE_COMPUTER),
    KEY_AC_SEARCH = SCANCODE_TO_KEYCODE(SCANCODE_AC_SEARCH),
    KEY_AC_HOME = SCANCODE_TO_KEYCODE(SCANCODE_AC_HOME),
    KEY_AC_BACK = SCANCODE_TO_KEYCODE(SCANCODE_AC_BACK),
    KEY_AC_FORWARD = SCANCODE_TO_KEYCODE(SCANCODE_AC_FORWARD),
    KEY_AC_STOP = SCANCODE_TO_KEYCODE(SCANCODE_AC_STOP),
    KEY_AC_REFRESH = SCANCODE_TO_KEYCODE(SCANCODE_AC_REFRESH),
    KEY_AC_BOOKMARKS = SCANCODE_TO_KEYCODE(SCANCODE_AC_BOOKMARKS),

    KEY_BRIGHTNESSDOWN =
        SCANCODE_TO_KEYCODE(SCANCODE_BRIGHTNESSDOWN),
    KEY_BRIGHTNESSUP = SCANCODE_TO_KEYCODE(SCANCODE_BRIGHTNESSUP),
    KEY_DISPLAYSWITCH = SCANCODE_TO_KEYCODE(SCANCODE_DISPLAYSWITCH),
    KEY_KBDILLUMTOGGLE =
        SCANCODE_TO_KEYCODE(SCANCODE_KBDILLUMTOGGLE),
    KEY_KBDILLUMDOWN = SCANCODE_TO_KEYCODE(SCANCODE_KBDILLUMDOWN),
    KEY_KBDILLUMUP = SCANCODE_TO_KEYCODE(SCANCODE_KBDILLUMUP),
    KEY_EJECT = SCANCODE_TO_KEYCODE(SCANCODE_EJECT),
    KEY_SLEEP = SCANCODE_TO_KEYCODE(SCANCODE_SLEEP)
};

EDUI_NAMESPACE_END

#endif